package com.example.administrator.myapplication.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2016/3/21 0021.
 */
public class DBHelper extends SQLiteOpenHelper{
    public DBHelper(Context context) {
        super(context, "my_db", null, 2);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {

        db.execSQL("create table score(_id integer primary key autoincrement,name varchar(32),level integer,score long)");

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("insert into score(name,level,score)values('jack1',4,500)");
        db.execSQL("insert into score(name,level,score)values('jack2',3,200)");
        db.execSQL("insert into score(name,level,score)values('jack3',5,400)");
        db.execSQL("insert into score(name,level,score)values('jack4',3,300)");
    }
}
